package com.xbongbong.saas.enums.product;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.FieldTypeEnum;
import com.xbongbong.saas.enums.SelectProductEnum;
import com.xbongbong.saas.enums.SetTypeEnum;
import com.xbongbong.saas.enums.ShowTypeEnum;
import lombok.Getter;

/**
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/10/15 14:50
 * @since v1.0
 */
@Getter
public enum PurchaseProductEnum {
    PRODUCT(SelectProductEnum.PRODUCT.getAttr(),SelectProductEnum.PRODUCT.getSaasAttr(),SelectProductEnum.PRODUCT.getI18nAttrName(),SelectProductEnum.PRODUCT.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,0,ShowTypeEnum.ALL.getCode(),1,1),
    UNIT(SelectProductEnum.UNIT.getAttr(),SelectProductEnum.UNIT.getSaasAttr(),"enum.purchaseProduct.attrName.purchase_unit",SelectProductEnum.UNIT.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,0,ShowTypeEnum.ALL.getCode(),1,0),
    NUM(SelectProductEnum.NUM.getAttr(),SelectProductEnum.NUM.getSaasAttr(),SelectProductEnum.NUM.getI18nAttrName(),SelectProductEnum.NUM.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,0,ShowTypeEnum.ALL.getCode(),1,1),
    // 采购单价就是成本吧,
    PURCHASE_PRICE(SelectProductEnum.PRICE.getAttr(),SelectProductEnum.PRICE.getSaasAttr(),"enum.purchaseProduct.attrName.purchase_price",SelectProductEnum.PRICE.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,0,ShowTypeEnum.ALL.getCode(),1,1),
    SUBTOTAL(SelectProductEnum.SUBTOTAL.getAttr(),SelectProductEnum.SUBTOTAL.getSaasAttr(),"enum.purchaseProduct.attrName.subtotal",SelectProductEnum.SUBTOTAL.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,0,ShowTypeEnum.ALL.getCode(),1,0),
    MEMO(SelectProductEnum.MEMO.getAttr(),SelectProductEnum.MEMO.getSaasAttr(),SelectProductEnum.MEMO.getI18nAttrName(),SelectProductEnum.MEMO.getFieldType(),SetTypeEnum.DISABLE_REPEAT.getCode(),0,0,ShowTypeEnum.ALL.getCode(),1,0),
    INSTOCK_NUM(SelectProductEnum.INSTOCK_NUM.getAttr(),SelectProductEnum.INSTOCK_NUM.getSaasAttr(),"enum.purchaseProduct.attrName.instock_num",SelectProductEnum.INSTOCK_NUM.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,0,ShowTypeEnum.LIST_DETAIL.getCode(),1,0),
    WAIT_INSTOCK_NUM(SelectProductEnum.WAIT_INSTOCK_NUM.getAttr(),SelectProductEnum.WAIT_INSTOCK_NUM.getSaasAttr(),"enum.purchaseProduct.attrName.wait_instock_num",SelectProductEnum.WAIT_INSTOCK_NUM.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,0,ShowTypeEnum.LIST_DETAIL.getCode(),1,0),
    RETURN_NUM(SelectProductEnum.RETURN_NUM.getAttr(),SelectProductEnum.RETURN_NUM.getSaasAttr(),SelectProductEnum.RETURN_NUM.getI18nAttrName(),SelectProductEnum.RETURN_NUM.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,0,ShowTypeEnum.LIST_DETAIL.getCode(),1,0),
    RECEIVE_STATUS(SelectProductEnum.DETAIL_STATUS.getAttr(),SelectProductEnum.DETAIL_STATUS.getSaasAttr(),"enum.purchaseProduct.attrName.receive_status",SelectProductEnum.DETAIL_STATUS.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,1,ShowTypeEnum.DETAIL.getCode(),1,0),
    CONTRACT_NO("text_22","contractNo","enum.purchaseProduct.attrName.contract_no", FieldTypeEnum.TEXT.getType(),SetTypeEnum.DISABLE_ALL.getCode(),0,1,ShowTypeEnum.EDIT.getCode(),1,0),
//    CONTRACT_ID("contractId","contractId","enum.contract.attrName.contract_id", FieldTypeEnum.TEXT.getType(),SetTypeEnum.DISABLE_ALL.getCode(),0,1,ShowTypeEnum.NONE.getCode(),0,0),

    //INSTOCK_NUM(SelectProductEnum.INSTOCK_NUM.getAttr(),SelectProductEnum.INSTOCK_NUM.getSaasAttr(),SelectProductEnum.INSTOCK_NUM.getAttrName(),SelectProductEnum.INSTOCK_NUM.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,1,ShowTypeEnum.DETAIL.getCode(),1,0),
    //WAIT_INSTOCK_NUM(SelectProductEnum.WAIT_INSTOCK_NUM.getAttr(),SelectProductEnum.WAIT_INSTOCK_NUM.getSaasAttr(),SelectProductEnum.WAIT_INSTOCK_NUM.getAttrName(),SelectProductEnum.WAIT_INSTOCK_NUM.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,1,ShowTypeEnum.DETAIL.getCode(),1,0),
    //RETURN_NUM(SelectProductEnum.RETURN_NUM.getAttr(),SelectProductEnum.RETURN_NUM.getSaasAttr(),SelectProductEnum.RETURN_NUM.getAttrName(),SelectProductEnum.RETURN_NUM.getFieldType(),SetTypeEnum.DISABLE_ALL.getCode(),0,1,ShowTypeEnum.DETAIL.getCode(),1,0),
    ;
    /**
     * 英文名称
     */
    private String attr;
    /**
     * 英文名称
     */
    private String saasAttr;
    /**
     * 中文名称
     */
    private String attrName;
    /**
     * 字段类型，详见
     *
     * @see FieldTypeEnum
     */
    private Integer fieldType;
    /**
     * 重命名、判重、启用必填等权限
     */
    private Integer setType;
    /**
     * 模板设计阶段字段是否允许编辑
     * 1：允许编辑
     * 0：不允许编辑
     */
    private Integer designEditable;
    /**
     * 字段是否显示在模板设计界面
     * 1：不显示
     * 0：显示
     */
    private Integer editHide;
    /**
     * 字段在各个界面（新建、编辑、列表、详情）的展现形式
     */
    private Integer showType;
    /**
     * 字段在各个界面是否可见(启用)
     * 1：可见
     * 0：不可见
     * 注：字段在具体页面的可见性需要用属性和showType联合判断，在visible=1的情况下判断showType
     */
    private Integer visible;
    /**
     * 字段是否必填
     * 1：必填
     * 0：不必填
     */
    private Integer required;

    PurchaseProductEnum(String attr,String saasAttr, String attrName, Integer fieldType, Integer setType, Integer designEditable, Integer editHide, Integer showType, Integer visible, Integer required) {
        this.attr = attr;
        this.saasAttr = saasAttr;
        this.attrName = attrName;
        this.fieldType = fieldType;
        this.setType = setType;
        this.designEditable = designEditable;
        this.editHide = editHide;
        this.showType = showType;
        this.visible = visible;
        this.required = required;
    }

    public String getAttrName() {
        return I18nMessageUtil.getMessage(attrName);
    }
}
